<?php
include('connection.php');
include('thuvien.php');
class LoaiSP
{
var $MaLoaiSP;
var $TenLoaiSP;
var $MoTaSP;
public function InfoLoaiSP($MaLoaiSP,$TenLoaiSP,$MoTaSP)
{
$this->MaLoaiSP=$MaLoaiSP;
$this->TenLoaiSP=$TenLoaiSP;
$this->MoTaSP=$MoTaSP;
}
public function GetAll_LoaiSP()
{
$sql="Select * From LoaiSP";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
public function Add_LoaiSP($TenLoaiSP,$MoTaSP)
{
$sql="Insert Into LoaiSP(`MaLoaiSP`,`TenLoaiSP`,`MoTaSP`)Values(Null,'$TenLoaiSP','$MoTaSP')";
$kq=@mysql_query($sql) or die (@mysql_error());
}
public function Delete_LoaiSP($MaLoaiSP)
{
$sql="delete From LoaiSP Where MaLoaiSP=$MaLoaiSP";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
public function Update_LoaiSP($MaLoaiSP,$TenLoaiSP,$MoTaSP)
{
$sql="Update LoaiSP Set `TenLoaiSP`='$TenLoaiSP',`MoTaSP`='$MoTaSP' Where MaLoaiSP=$MaLoaiSP";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
public function ById($id)
{
$sql="Select * From LoaiSP Where MaLoaiSP=$id";
$kq=@mysql_query($sql) or die (@mysql_error());
return $kq;
}
var $pindex;
var $totalp;

public function get_by_page($psize, $pindex, $where = '', $orderby = '')
{
	$this->pindex = $pindex;
	return get_page($psize, $pindex, $this->totalp, 'LoaiSP', $where = "",$orderby = "");
}
public function print_page()
{
	return print_page($this->totalp, $this->pindex);
}

}
?>